package cn.wolfcode.p2p.business.service;

import cn.wolfcode.p2p.base.qo.QueryObject;
import cn.wolfcode.p2p.business.domain.BidRequest;
import com.github.pagehelper.PageInfo;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

public interface IBidRequestService {
    int save(BidRequest bidRequest);
    int update(BidRequest bidRequest);

    BidRequest get(Long id);

    PageInfo queryPage(QueryObject qo);

    /**
     * 借款申请
     * @param bidRequest
     */
    void apply(BidRequest bidRequest);

    /**
     * 发标前审核
     * @param id
     * @param state
     * @param publishTime
     * @param remark
     */
    void audit(Long id, Integer state, Date publishTime, String remark);

    /**
     * 查询待发标列表
     * @return
     */
    List<BidRequest> queryPublishPendngBidRequests();

    /**
     * 查询最近一小时要发布的标
     * @return
     */
    List<BidRequest> queryPendingBidRequestListInOneHour();

    /**
     * 首页查询所有的标
     * @return
     */
    List<BidRequest> queryMainData();

    /**
     * 投标
     * @param bidRequestId
     * @param amount
     */
    void bid(Long bidRequestId, BigDecimal amount);

    /**
     * 满标一审
     * @param id
     * @param state
     * @param remark
     */
    void audit1(Long id, Integer state, String remark);

    /**
     * 满标二审
     * @param id
     * @param state
     * @param remark
     */
    void audit2(Long id, Integer state, String remark);

    /**
     * 发布体验标
     * @param bidRequest
     */
    void expApply(BidRequest bidRequest);

    /**
     * 取消借款
     * @param bidRequestId
     */
    void cancelBorrow(Long bidRequestId);

    /**
     * 查询最近一小时要过了招标截止时间,但还没招满的标
     * @return
     */
    List<BidRequest> queryPassDisableDateBidRequestListInOneHour();

    /**
     * 流标
     * @param bidRequest
     */
    void failureOfBid(BidRequest bidRequest);
}
